package thinking

import thinking.函数高级.CompareComm

object 试图界定案例 {
  def main(args: Array[String]): Unit = {
    val p1 = new Person("tom", 10)
    val p2 = new Person("Sam", 20)
    val value = new CompareComm[Person](p1, p2)
    println(value.greater)
  }

  class Person(val name: String, val age: Int) extends Ordered[Person] {
    override def compare(that: Person): Int = {
      this.age - that.age
    }

    override def toString = s"Person($name, $age)"
  }

}
